﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace wuo._typ
{
    internal static class typfo
    {
        public static typdefs resolve(object obj)
        {
            if (obj is null) return typdefs.NULL;
            else if (obj is string) return typdefs.STRING;
            else if (obj is bool _bool) if (_bool) return typdefs.BOOL_TRUE; else return typdefs.BOOL_FALSE;
            else if (obj is int) return typdefs.INT;
            else if (obj is short) return typdefs.SHORT;
            else if (obj is ushort) return typdefs.USHORT;
            else if (obj is uint) return typdefs.UINT;
            else if (obj is byte) return typdefs.BYTE;
            else if (obj is byte[]) return typdefs.BYTES;
            else if (obj is long) return typdefs.LONG;
            else if (obj is ulong) return typdefs.ULONG;
            else if (obj is float) return typdefs.FLOAT;
            else if (obj is double) return typdefs.DOUBLE;
            else if (obj is char) return typdefs.CHAR;
            else if (obj is decimal) return typdefs.DECIMAL;
            else if (obj is DateTime) return typdefs.DATETIME;
            else if (obj is Guid) return typdefs.GUID;
            else if (obj is Dictionary<string, string>) return typdefs.DICTIONARY_STRING_STRING;
            else if (obj is List<string>) return typdefs.LIST_STRING;
            else if (obj is Array) return typdefs.ARRARY;
            else if (obj is Enum) return typdefs.ENUM;
            else if (obj is DictionaryBase) return typdefs.DICT;

            return typdefs.UNKNOWN;
        }
    }
}
